package com.ruoyi.teaching.service.impl;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.teaching.domain.RepetitiveManagement;
import com.ruoyi.teaching.domain.dto.TaskDto;
import com.ruoyi.teaching.mapper.RepetitiveManagementMapper;
import com.ruoyi.teaching.mapper.TaskHistoryMapper;
import com.ruoyi.teaching.service.IRepetitiveManagementService;
import com.ruoyi.teaching.service.ITaskHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 留级管理Service业务层处理
 * 
 * @author thl
 * @date 2024-01-05
 */
@Service
public class RepetitiveManagementServiceImpl implements IRepetitiveManagementService 
{
    @Autowired
    private RepetitiveManagementMapper repetitiveManagementMapper;
    @Autowired
    private ITaskHistoryService insertTaskHistory;
    @Autowired
    private TaskHistoryMapper taskHistoryMapper;



    @Override
    public AjaxResult editTask(TaskDto taskDto) {
        TaskDto task = new TaskDto();
        task.setId(taskDto.getId());
        task.setStudentName(taskDto.getStudentName());
        task.setTaskDate(taskDto.getTaskDate());
        task.setTaskState(taskDto.getTaskState());
        task.setTaskIllustrate(taskDto.getTaskIllustrate());

        taskHistoryMapper.task(task);
        return AjaxResult.success();
    }
    /**
     * 查询留级管理
     * 
     * @param id 留级管理主键
     * @return 留级管理
     */
    @Override
    public RepetitiveManagement selectRepetitiveManagementById(Long id)
    {
        return repetitiveManagementMapper.selectRepetitiveManagementById(id);
    }

    /**
     * 查询留级管理列表
     * 
     * @param repetitiveManagement 留级管理
     * @return 留级管理
     */
    @Override
    public List<RepetitiveManagement> selectRepetitiveManagementList(RepetitiveManagement repetitiveManagement)
    {
        return repetitiveManagementMapper.selectRepetitiveManagementList(repetitiveManagement);
    }

    /**
     * 新增留级管理
     * 
     * @param repetitiveManagement 留级管理
     * @return 结果
     */
    @Override
    public int insertRepetitiveManagement(RepetitiveManagement repetitiveManagement)
    {
        return repetitiveManagementMapper.insertRepetitiveManagement(repetitiveManagement);
    }

    /**
     * 修改留级管理
     * 
     * @param repetitiveManagement 留级管理
     * @return 结果
     */
    @Override
    public int updateRepetitiveManagement(RepetitiveManagement repetitiveManagement)
    {
        return repetitiveManagementMapper.updateRepetitiveManagement(repetitiveManagement);
    }

    /**
     * 批量删除留级管理
     * 
     * @param ids 需要删除的留级管理主键
     * @return 结果
     */
    @Override
    public int deleteRepetitiveManagementByIds(Long[] ids)
    {
        return repetitiveManagementMapper.deleteRepetitiveManagementByIds(ids);
    }

    /**
     * 删除留级管理信息
     * 
     * @param id 留级管理主键
     * @return 结果
     */
    @Override
    public int deleteRepetitiveManagementById(Long id)
    {
        return repetitiveManagementMapper.deleteRepetitiveManagementById(id);
    }


}
